package com.zqh.lockSupport;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.LockSupport;

/**
 * @author 曾庆红
 * {@code @date} 2023-10-14 19:30
 */

public class T1 {

    public static void main(String[] args) {
        Thread t = new Thread(()->{
            for(int i =0; i<10; i++){
                System.out.println(i);
                if(i == 5){
                    LockSupport.park();
                }
                try {
                    TimeUnit.SECONDS.sleep(1);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });
        t.start();
        LockSupport.unpark(t);
    }
}
